-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(SDK-312) Add option --parallel to pdk test unit
#154
Conversation
lib/pdk/tests/unit.rb
Outdated
# TODO: test selection | ||
[File.join(PDK::Util.module_root, 'bin', 'rake'), 'spec'] | ||
if opts.key?(:parallel) | ||
[File.join(PDK::Util.module_root, 'bin', 'rake'), 'parallel'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to change once puppetlabs_spec_helper is updated. Added the updated parallel_spec
task to the module's Rakefile as parallel
to avoid name conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is just deciding between two rake tasks, you can remove a bit of duplication here by changing the method content to something like this
rake_task = opts.key?(:parallel) ? 'parallel' : 'spec'
[File.join(PDK::Util.module_root, 'bin', 'rake'), rake_task]
ff054ae
to
b1c9fe6
Compare
pdk test unit
pdk test unit
pdk test unit
044208b
to
11b9407
Compare
37819ff
to
0e8d00f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of recommended changes to the spec descriptions, otherwise 👍. Nice work @austb
spec/unit/pdk/test/unit_spec.rb
Outdated
require 'pdk/tests/unit' | ||
|
||
describe PDK::Test::Unit do | ||
describe 'merging json results' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should change the description of this example group to the method being tested describe '.merge_json_results'
spec/unit/pdk/test/unit_spec.rb
Outdated
end | ||
end | ||
|
||
describe '#cmd' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a class method, so .cmd
would be better.
spec/unit/pdk/test/unit_spec.rb
Outdated
end | ||
end | ||
|
||
describe '#parse_output' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a class method, so .parse_output
would be better.
spec/unit/pdk/test/unit_spec.rb
Outdated
|
||
# Allow any_instance stubbing of Commands | ||
# rubocop:disable RSpec/AnyInstance | ||
describe '#list' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a class method, so .list
would be better.
spec/unit/pdk/test/unit_spec.rb
Outdated
end | ||
end | ||
|
||
describe '#invoke' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a class method, so .invoke
would be better.
Uses the puppetlabs_spec_helper Rake task 'parallel_spec' to run spec tests in parallel. This will run the Rake task in multiple Processes to avoid the limitation on Thread speed increases due to MRI Ruby's Global Interpreter Lock. This means that rspec initialization effort will be duplicated.
Waiting for a new version of puppetlabs_spec_helper for the updated rake task
Update:
I now believe it's waiting for a new version of puppet-module-gems
Update 2:
v0.1.0 of puppet-module-gems has been released